<?php
require_once 'init.php';
if(!$sessionID){
	header('location:login.php');
}

$action = isset($_GET['action'])?$_GET['action']:'';
if(!in_array($action,array('wedding','studio','cooperation','guest'))){
	header('location:index.php');
}
/*	$xml = simplexml_load_file($contentDB);
	$children = $xml->children();
	$content = $children[1];
	$pages = $content->children();
	if($action=='wedding'){
		$page = $pages[2];
	}elseif($action=='studio'){
		$page = $pages[3];
	}elseif($action=='cooperation'){
		$page = $pages[4];
	}elseif($action=='guest'){
		$page = $pages[6];
	}
	$album = array();
	foreach($page->children() as $item){
		$attrs = $item->attributes();
		$arr = array();
		if((int)$attrs['id']==$id){
			$album['id'] = $id;
			$album['src'] = (string)$attrs['coverUrl'];
			$album['name'] = (string)$attrs['photoName'];
		}
	}*/
?>
<html>
<head>
	<meta charset="utf-8" />
	<link rel="stylesheet" href="<?php echo $host;?>/manager/css/default.css" />
</head>
<body>
	<div class="header"></div>
	<div class="middle">
		<div class="left">
			<?php require_once 'left.php';?>		
		</div>
		<div class="right">
			<form action="albumAddSave.php" method="post" />
			<table class="imageTable">
				<tr>
					<td>相册名称</th>
					<td><input type="text" name="name" value="" /></td>
				</tr>
				<tr style="display:none;">
					<td>封面</th>
					<td><img class="imageSrc" src="" width="100" height="100" /></td>
				</tr>
				<tr>
					<td colspan="2">
						<input type="file" name="file_upload" id="file_upload" />
					</td>
				</tr>
				<tr>
					<td colspan="2"><input type="submit" value="保存" /></td>
				</tr>
			</table>
			<input type="hidden" name="src" class="postSrc" value="" />
			<input type="hidden" name="action" value="<?php echo $action;?>" />
			</form>
	</div>
	</div>
	<div class="footer">
	</div>
<script type="text/javascript" src="/manager/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="/manager/js/uploadify/jquery.uploadify-3.1.min.js"></script>
<script type="text/javascript">
$(function() {
	$("#file_upload").uploadify({
		'swf'      : '/manager/js/uploadify/uploadify.swf',
		'uploader' : '/manager/uploadify.php',
		'queueSizeLimit':1,
		'formData':{'width':200,'height':200},
		'onUploadSuccess':function(file,data,response){
			$(".imageSrc").attr('src','/'+data).parents('tr').show();
			$(".postSrc").val(data);
		}
	});
});
</script>
</body>
</html>
